package com.cf.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cf.domain.pojo.TeamMember;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface TeamMemberMapper extends BaseMapper<TeamMember> {

    @Update("update t_team_member set member_name = #{memberName}, member_phone = #{memberPhone}, member_email = #{memberEmail} where id = #{id}")
    int updateTeamMember(@Param("id") Long id, @Param("memberName") String memberName, @Param("memberPhone") String memberPhone, @Param("memberEmail") String memberEmail);

    @Delete("DELETE FROM t_team_member WHERE team_id = #{team_id}")
    int deleteTeamMemberByTeamId(@Param("team_id") Long teamId);

    @Select("SELECT member_name,member_phone,member_email FROM t_team_member WHERE user_id = #{userId}")
    List<TeamMember> getMembersByUserId(Long userId);
}
